package com.hrt.manage.bkgoods.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hrt.bean.BackGoods;
import com.hrt.manage.bkgoods.dao.BackGoodsDao;
import com.hrt.manage.bkgoods.service.BackGoodsService;
@Service
public class BackGoodsServiceImpl implements BackGoodsService{
	@Resource BackGoodsDao backGoodsDao;
	@Override
	public Long totalCount() {
		return backGoodsDao.totalCount();
	}

	@Override
	public void deleteById(Long[] ids) throws Exception {
		List<BackGoods> delResult = backGoodsDao.getByIds(ids);
		for (BackGoods bg : delResult) {
			bg.setIsdelete(new Integer(1));
			backGoodsDao.updateEntity(bg);
		}
		
	}

	@Override
	public void saveBackGoods(BackGoods backGoods) throws Exception {
		backGoodsDao.saveEntity(backGoods);
		
	}

	@Override
	public List queryByPage(int pageIndex, int pageSize) {
		return backGoodsDao.queryByPage(pageIndex, pageSize);
	}

	@Override
	public void updateBackGoods(BackGoods backGoods) {
		backGoodsDao.updateEntity(backGoods);
		
	}

	@Override
	public List<BackGoods> queryByOrderId(Long orderId) {
		return backGoodsDao.queryByOrderId(orderId);
	}

	@Override
	public Long countOrderBackGoodes(Long giftDetailId, Long orderId) {
		// TODO Auto-generated method stub
		
		return backGoodsDao.countOrderBackGoodes(giftDetailId, orderId);
	}

}
